package Java0308;

import java.util.Scanner;

public class Loop7 {
    public static void main(String[] args) {
        //输入10个数，求他们所有数的和
        Scanner scan = new Scanner(System.in);
        //定义循环变量并赋初值
        int i = 0;
        //定义sum存储总和
        int sum = 0;
        //定义num存储从键盘录入的数字
        int num = 0;
        while (i < 10) {
            //循环变量自增
            i++;
            System.out.print("请输入第" + i + "个数:");
            num = scan.nextInt();
            //计算10个数的和
            sum += num;
        }
        System.out.println("*************************");
        System.out.println("sum = " + sum);
    }
}
